# 指定最低版本
cmake_minimum_required(VERSION 2.6)

# 生成工程名
project(tcpa_monitor)

# 编译选项
set(CMAKE_C_FLAGS "-Wall -Werror -Wno-unused-function -Wno-unused-variable")

# 设置debug模式
set(CMAKE_BUILD_TYPE Debug)

# 区分平台
# set(IN_TD_SYSTEM OFF)
if(IN_TD_SYSTEM)
    add_definitions(-DTD_SYSTEM)
    add_definitions(-DUSER)
    include_directories(${CMAKE_INSTALL_PREFIX}/include)
    link_directories(${CMAKE_INSTALL_PREFIX}/lib)
endif()

# 定义宏将当前路径传递到应用程序
set(CURRENT_DIR ${CMAKE_SOURCE_DIR})
add_definitions(-DCURRENT_DIR="${CURRENT_DIR}")

# debug_build
# set(CMAKE_BUILD_TYPE DEBUG)

message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
# 指定头文件检索路径
include_directories(${CMAKE_SOURCE_DIR}/include)

# 指定库文件检索路径
link_directories(${CMAKE_SOURCE_DIR}/lib)

# 添加检索目录
add_subdirectory(src)
add_subdirectory(test)

# 生成可执行文件
add_executable(tcpa_monitor main.c)
# 链接库文件
target_link_libraries(tcpa_monitor tcpa_lib)